<!DOCTYPE html>
<html lang="zh-CN">

  <head>
  <meta charset="utf-8">
  <meta name="author" content="zchengsite, 1451426471@qq.com" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  
  
  <title>Complete list of PIN-blocks   | EMV.COOL</title>

  
    <link rel="apple-touch-icon" href="/images/favicon.png">
    <link rel="icon" href="/images/favicon.png">
  

  <!-- Raleway-Font -->
  <link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">

  <!-- hexo site css -->
  
<link rel="stylesheet" href="/css/base.css">
<link rel="stylesheet" href="/iconfont/iconfont.css">
<link rel="stylesheet" href="/css/github-markdown.css">
<link rel="stylesheet" href="/css/highlight.css">


  <!-- jquery3.3.1 -->
  <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

  <!-- fancybox -->
  <link href="https://cdn.bootcss.com/fancybox/3.5.2/jquery.fancybox.min.css" rel="stylesheet">
  <script async src="https://cdn.bootcss.com/fancybox/3.5.2/jquery.fancybox.min.js"></script>
  
<script src="/js/fancybox.js"></script>


  
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-144519052-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'UA-144519052-1');
    </script>
  

   
    <meta name="keywords" content="pin,密码,PIN-blocks,银行卡加密,dukpt,3des,emv,blog,victor,victorlong,龙熙应,longxiying,emv.cool,aid,sale,void,visa,master,android,QuickChip,tag,emvtag,paypass,paywave,dpas,contact,contactless,card,pos,pin,pin-blocks,atrs,hsm,key,dukpt,3des,des,sm4,sm3,apdu,tsys,Hexo,ilovejj">
    

<meta name="generator" content="Hexo 5.3.0"><link rel="alternate" href="/atom.xml" title="EMV.COOL" type="application/atom+xml">
</head>


  <body>
    <div id="app">
      <div class="header">
  <div class="avatar">
    <a href="/">
      <!-- 头像取消懒加载，添加no-lazy -->
      
        <img src="/images/avatar.png" alt="">
      
    </a>
    <div class="nickname"><a href="/">EMV.COOL</a></div>
  </div>
  <div class="navbar">
    <ul>
      
        <li class="nav-item" data-path="/">
          <a href="/">Home</a>
        </li>
      
        <li class="nav-item" data-path="/archives/">
          <a href="/archives/">Archives</a>
        </li>
      
        <li class="nav-item" data-path="/tags/">
          <a href="/tags/">Tags</a>
        </li>
      
        <li class="nav-item" data-path="/friends/">
          <a href="/friends/">Friends</a>
        </li>
      
        <li class="nav-item" data-path="/about/">
          <a href="/about/">About</a>
        </li>
      
    </ul>
  </div>
</div>


<script src="/js/activeNav.js"></script>



      <div class="flex-container">
        <!-- 文章详情页，展示文章具体内容，url形式：https://yoursite/文章标题/ -->
<!-- 同时为「标签tag」，「朋友friend」，「分类categories」，「关于about」页面的承载页面，具体展示取决于page.type -->



  

  

  

  
  <!-- 文章内容页 url形式：https://yoursite/文章标题/ -->
  <div class="container post-details" id="post-details">
    <div class="post-content">
      <div class="post-title">Complete list of PIN-blocks</div>
      <div class="post-attach">
        <span class="post-pubtime">
          <i class="iconfont icon-updatetime" title="Update time"></i>
          2020-12-23
        </span>
        
              <span class="post-tags">
                <i class="iconfont icon-tags" title="Tags"></i>
                
                <span class="span--tag">
                  <a href="/tags/EMV/" title="EMV">
                    <b>#</b> EMV
                  </a>
                </span>
                
              </span>
          
      </div>
      <div class="markdown-body">
        <p>The most common PIN-block formats are based on ISO 9564, but many more are in implemented worldwide. Another common problem is that same PIN-block calculation methods are being called with their aliases, making sometimes difficult to get a right one. This article brings a list of PIN-blocks applied in payments, their calculation methods and examples and bit of related background.</p>
<p>Well worded Wikipedia’s definition of a PIN-block format: «The PIN is used to verify the identity of a customer (the user of a bank card) within an electronic funds transfer system, and (typically) to authorize the transfer of funds, so it is important to protect it against unauthorized disclosure or misuse. Modern banking systems require interoperability between different card issuers, acquiring banks and retailers – including transmission of PINs between those entities – so a common set of rules for handling and securing PINs is required, both to ensure technical compatibility and a mutually agreed level of security.»</p>
<table>
<thead>
<tr>
<th><strong>PIN Block Format</strong></th>
<th><strong>Alias</strong></th>
<th><strong>Description</strong></th>
</tr>
</thead>
<tbody><tr>
<td>ISO-0</td>
<td>Format 0, ANSI X9.8, VISA-1, and ECI-0</td>
<td>ISO 9564-1 Format 0. An ISO-0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats and is similar to a VISA-4 PIN block format. The ISO-0 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right. The first nibble (which identifies the block format) has the value 0.</td>
</tr>
<tr>
<td>ISO-1</td>
<td>Format 1 and ECI-4</td>
<td>ISO 9564-1:2003 Format 1. The ISO-1 PIN block format is equivalent to an ECI-4 PIN block format and is recommended for usage where no PAN data is available. The ISO-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right. The first nibble (which identifies the block format) has the value 1.</td>
</tr>
<tr>
<td>ISO-2</td>
<td>Format 2</td>
<td>ISO 9564-3: 2003 Format 2. Format 2 is for local use with off-line systems only. The first nibble (which identifies the block format) has the value 2.</td>
</tr>
<tr>
<td>ISO-3</td>
<td>Format 3</td>
<td>ISO 9564-1: 2002 Format 3. Format 3 is the same as format 0, except that the “fill” digits are random values from 10 to 15, and the first nibble (which identifies the block format) has the value 3.</td>
</tr>
<tr>
<td>ANSI X9.8</td>
<td>–</td>
<td>Same as ISO 9564 Format 0 (ISO-0)</td>
</tr>
<tr>
<td>OEM-1</td>
<td>Diebold, Docutel, NCR</td>
<td>The OEM-1 PIN block format is equivalent to the PIN block formats that Diebold, Docutel, and NCR define. The OEM-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right. Identical to existing Docutel 5100 Format 8</td>
</tr>
<tr>
<td>ECI-1</td>
<td>–</td>
<td>Eurocheque International format 1. Same as ISO 9564 Format 0 (ISO-0)</td>
</tr>
<tr>
<td>ECI-2</td>
<td>–</td>
<td>Eurocheque International format 2. The ECI-2 PIN block format supports a 4-digit PIN. A PIN that is longer than 4 digits is truncated on the right.</td>
</tr>
<tr>
<td>ECI-3</td>
<td>–</td>
<td>Eurocheque International format 3. The ECI-3 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.</td>
</tr>
<tr>
<td>ECI-4</td>
<td>–</td>
<td>Eurocheque International format 4. Same as ISO 9564 Format 1 (ISO-1)</td>
</tr>
<tr>
<td>IBM 3621</td>
<td></td>
<td>The 3621 PIN block format supports a PIN from 1 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</td>
</tr>
<tr>
<td>IBM 3624</td>
<td>PIN-TRAN 4</td>
<td>The 3624 PIN block format is equivalent to the PIN-TRAN 4 format and supports a PIN from 1 to 16 digits in length. A PIN that is longer than 16 digits is truncated on the right.</td>
</tr>
<tr>
<td>IBM 4704-EPP (Encrypting PIN Pad)</td>
<td>–</td>
<td>The 4704 encrypting PIN Pad PIN block format supports a PIN from 1 to 13 digits in length. A PIN that is longer than 13 digits is truncated on the right.</td>
</tr>
<tr>
<td>IBM 5906</td>
<td></td>
<td>Same as IBM 3621.</td>
</tr>
<tr>
<td>VISA-1</td>
<td>–</td>
<td>Same as ISO 9564 Format 0 (ISO-0)</td>
</tr>
<tr>
<td>VISA-2</td>
<td>Docutel 2</td>
<td>The VISA-2 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.</td>
</tr>
<tr>
<td>VISA-3</td>
<td>–</td>
<td>The VISA-3 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</td>
</tr>
<tr>
<td>VISA-4</td>
<td>–</td>
<td>The VISA-4 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</td>
</tr>
<tr>
<td>Docutel 2</td>
<td>VISA-2</td>
<td>Same as VISA-2. Contains 1-digit PIN length, 4 to 6-digit PIN and a user-defined padding string of 9 digits. If the PIN has 4 or 5 digits, it is initially padded to the right with 2 or 1 zero digits to total 6 digits.</td>
</tr>
<tr>
<td>AS2805 Format 1</td>
<td>–</td>
<td>The AS2805 Format 1 PIN block is used in situations where the account number is not available. The PIN block is formed by concatenation of the PIN and other data. PIN block format supports a PIN from 4 to 12 digits in length.</td>
</tr>
<tr>
<td>AS2805 Format 8</td>
<td>Format 46</td>
<td>The zero length PIN block format is identical to format 01 with the some exceptions.</td>
</tr>
<tr>
<td>ISO-4</td>
<td>Format 4</td>
<td>ISO 9564-1: 2017 Format 4. Format 4 uses AES encryption. PIN Block is padded with fill digit ‘A’ and also with random random values from 0 to 15, and the first nibble (which identifies the block format) has the value 4.</td>
</tr>
</tbody></table>
<h2 id="ISO-0-FORMAT-0"><a href="#ISO-0-FORMAT-0" class="headerlink" title="ISO-0 (FORMAT 0)"></a>ISO-0 (FORMAT 0)</h2><p>Is the first and most common PIN block encoding format based on ISO 9564 – an international standard for personal identification number (PIN) management and security in retail banking.</p>
<h4 id="CALCULATION-STEPS"><a href="#CALCULATION-STEPS" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-padding-value-“F”"><a href="#1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-padding-value-“F”" class="headerlink" title="1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value “F”"></a>1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value “F”</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
</tr>
</tbody></table>
<h5 id="2-Prepare-PAN-–-take-12-rightmost-digits-of-the-primary-account-number-excluding-the-check-digit"><a href="#2-Prepare-PAN-–-take-12-rightmost-digits-of-the-primary-account-number-excluding-the-check-digit" class="headerlink" title="2. Prepare PAN – take 12 rightmost digits of the primary account number (excluding the check digit)"></a>2. Prepare PAN – take 12 rightmost digits of the primary account number (excluding the check digit)</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
</tr>
</tbody></table>
<h5 id="3-XOR-both-values"><a href="#3-XOR-both-values" class="headerlink" title="3. XOR both values"></a>3. XOR both values</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
</tr>
<tr>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
</tr>
</tbody></table>
<h4 id="EXAMPLE"><a href="#EXAMPLE" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line"></span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 0 (ISO-0)  </span><br><span class="line"> </span><br><span class="line">Clear PIN block:0412AC89ABCDEF67</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line"></span><br><span class="line">PIN block: 0412AC89ABCDEF67  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 0 (ISO-0)  </span><br><span class="line"></span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ISO-1-FORMAT-1"><a href="#ISO-1-FORMAT-1" class="headerlink" title="ISO-1 (FORMAT 1)"></a>ISO-1 (FORMAT 1)</h2><p>The ISO-1 PIN block format is equivalent to an ECI-4 PIN block format. The ISO-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-1"><a href="#CALCULATION-STEPS-1" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value"><a href="#1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value" class="headerlink" title="1. Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value"></a>1. Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>1</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  L – is the length of the PIN, which is a 4-bit value from X’4′ to X’C’.</p>
</li>
<li><p>  R – is a random digit, which is a value from X’0′ to X’F’. Typically, this should be used for predetermined transaction unique data such as a sequence number.</p>
</li>
</ul>
<h4 id="EXAMPLE-1"><a href="#EXAMPLE-1" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">   </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 1 (ISO-1)  </span><br><span class="line"></span><br><span class="line">Clear PIN block:141234CE8C767872</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 141234CE8C767872  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 1 (ISO-1)  </span><br><span class="line"> </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ISO-2-FORMAT-2"><a href="#ISO-2-FORMAT-2" class="headerlink" title="ISO-2 (FORMAT 2)"></a>ISO-2 (FORMAT 2)</h2><p>Format 2 is for local use with off-line systems only (e.g. smart cards).</p>
<h4 id="CALCULATION-STEPS-2"><a href="#CALCULATION-STEPS-2" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-padding-value-‘F’"><a href="#1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-padding-value-‘F’" class="headerlink" title="1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value ‘F’"></a>1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value ‘F’</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>2</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  L – is the length of the PIN, which is a 4-bit value from X’4′ to X’C’.</p>
</li>
<li><p>  F – is a padding character, which is a value of X’F’.</p>
</li>
</ul>
<h4 id="EXAMPLE-2"><a href="#EXAMPLE-2" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 2 (ISO-2)  </span><br><span class="line"></span><br><span class="line">Clear PIN block:241234FFFFFFFFFF</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 241234FFFFFFFFFF  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 2 (ISO-2)  </span><br><span class="line"></span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ISO-3-FORMAT-3"><a href="#ISO-3-FORMAT-3" class="headerlink" title="ISO-3 (FORMAT 3)"></a>ISO-3 (FORMAT 3)</h2><p>Format 3 is the same as format 0, except that the “fill” digits are random values from 10 to 15, and the first nibble (which identifies the block format) has the value 3.</p>
<h4 id="CALCULATION-STEPS-3"><a href="#CALCULATION-STEPS-3" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><ol>
<li> Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value from X’0′ to X’F’</li>
</ol>
<table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>3</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
</tr>
</tbody></table>
<ol>
<li> Prepare PAN – take 12 rightmost digits of the primary account number (excluding the check digit)</li>
</ol>
<table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
</tr>
</tbody></table>
<ol>
<li> XOR both values</li>
</ol>
<table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
</tr>
<tr>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
</tr>
</tbody></table>
<h4 id="EXAMPLE-3"><a href="#EXAMPLE-3" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 3 (ISO-3)  </span><br><span class="line"></span><br><span class="line">Clear PIN block:3412ACC9B98CDF43</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 3412ACC9B98CDF43  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 3 (ISO-3)  </span><br><span class="line"></span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ISO-4-FORMAT-4"><a href="#ISO-4-FORMAT-4" class="headerlink" title="ISO-4 (FORMAT 4)"></a>ISO-4 (FORMAT 4)</h2><p>ISO 9564-1: 2017 Format 4. Format 4 uses AES-128 ECB encryption. PIN Block is padded with fill digit ‘A’ and also with random random values from 0 to 15, and the first nibble (which identifies the block format) has the value 4.</p>
<h4 id="CALCULATION-STEPS-4"><a href="#CALCULATION-STEPS-4" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-fill-digit-‘A’-R-is-random-value-from-X’0′-to-X’F’"><a href="#1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-fill-digit-‘A’-R-is-random-value-from-X’0′-to-X’F’" class="headerlink" title="1.  Prepare a PIN – L is length of the PIN, P is PIN digit, F is fill digit ‘A’. R is random value from X’0′ to X’F’"></a>1.  Prepare a PIN – L is length of the PIN, P is PIN digit, F is fill digit ‘A’. R is random value from X’0′ to X’F’</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
<th><strong>17</strong></th>
<th><strong>18</strong></th>
<th><strong>19</strong></th>
<th><strong>20</strong></th>
<th><strong>21</strong></th>
<th><strong>22</strong></th>
<th><strong>23</strong></th>
<th><strong>24</strong></th>
<th><strong>25</strong></th>
<th><strong>26</strong></th>
<th><strong>27</strong></th>
<th><strong>28</strong></th>
<th><strong>29</strong></th>
<th><strong>30</strong></th>
<th><strong>31</strong></th>
<th><strong>32</strong></th>
</tr>
</thead>
<tbody><tr>
<td>4</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>F</td>
<td>F</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
</tr>
</tbody></table>
<h5 id="2-Prepare-PAN-–-take-the-primary-account-number-–-M-is-PAN-length-indicating-PAN-length-of-12-plus-the-value-of-the-field-‘0’-‘7’-ranging-then-from-12-to-19-If-the-PAN-is-less-than-12-digits-the-digits-are-right-justified-and-padded-to-the-left-with-zeros-and-M-is-set-to-‘0’-A-is-PAN-digit-0-is-PAD-digit-‘0’"><a href="#2-Prepare-PAN-–-take-the-primary-account-number-–-M-is-PAN-length-indicating-PAN-length-of-12-plus-the-value-of-the-field-‘0’-‘7’-ranging-then-from-12-to-19-If-the-PAN-is-less-than-12-digits-the-digits-are-right-justified-and-padded-to-the-left-with-zeros-and-M-is-set-to-‘0’-A-is-PAN-digit-0-is-PAD-digit-‘0’" class="headerlink" title="2.  Prepare PAN – take the primary account number – M is PAN length indicating PAN length of 12 plus the value of the field ‘0’-‘7’ (ranging then from 12 to 19). If the PAN is less than 12 digits, the digits are right justified and padded to the left with zeros and M is set to ‘0’. A is PAN digit, 0 is PAD digit ‘0’"></a>2.  Prepare PAN – take the primary account number – M is PAN length indicating PAN length of 12 plus the value of the field ‘0’-‘7’ (ranging then from 12 to 19). If the PAN is less than 12 digits, the digits are right justified and padded to the left with zeros and M is set to ‘0’. A is PAN digit, 0 is PAD digit ‘0’</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
<th><strong>17</strong></th>
<th><strong>18</strong></th>
<th><strong>19</strong></th>
<th><strong>20</strong></th>
<th><strong>21</strong></th>
<th><strong>22</strong></th>
<th><strong>23</strong></th>
<th><strong>24</strong></th>
<th><strong>25</strong></th>
<th><strong>26</strong></th>
<th><strong>27</strong></th>
<th><strong>28</strong></th>
<th><strong>29</strong></th>
<th><strong>30</strong></th>
<th><strong>31</strong></th>
<th><strong>32</strong></th>
</tr>
</thead>
<tbody><tr>
<td>M</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A</td>
<td>A/0</td>
<td>A/0</td>
<td>A/0</td>
<td>A/0</td>
<td>A/0</td>
<td>A/0</td>
<td>A/0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
</tbody></table>
<h5 id="2-PIN-block-is-encrypted-with-AES-key"><a href="#2-PIN-block-is-encrypted-with-AES-key" class="headerlink" title="2.  PIN block is encrypted with AES key"></a>2.  PIN block is encrypted with AES key</h5><h5 id="3-The-resulting-Intermediate-Block-A-is-then-XOR’ed-with-PAN-Block"><a href="#3-The-resulting-Intermediate-Block-A-is-then-XOR’ed-with-PAN-Block" class="headerlink" title="3.  The resulting Intermediate Block A is then XOR’ed with PAN Block"></a>3.  The resulting Intermediate Block A is then XOR’ed with PAN Block</h5><h5 id="4-The-resulting-Intermediate-Block-B-is-enciphered-with-the-AES-key-again-so-we-get-the-Enciphered-PIN-Block"><a href="#4-The-resulting-Intermediate-Block-B-is-enciphered-with-the-AES-key-again-so-we-get-the-Enciphered-PIN-Block" class="headerlink" title="4.  The resulting Intermediate Block B is enciphered with the AES key again so we get the Enciphered PIN Block"></a>4.  The resulting Intermediate Block B is enciphered with the AES key again so we get the Enciphered PIN Block</h5><h4 id="EXAMPLE-4"><a href="#EXAMPLE-4" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 432198765432109870  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 4 (ISO-4)  </span><br><span class="line"></span><br><span class="line">Clear PIN block:441234AAAAAAAAAA911B9B36BC7CE94E  </span><br><span class="line">Clear PAN block:64321987654321098700000000000000</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 441234AAAAAAAAAA911B9B36BC7CE94E  </span><br><span class="line">PAN block: 64321987654321098700000000000000  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: Format 4 (ISO-4)  </span><br><span class="line"></span><br><span class="line">Decoded PIN: 1234  </span><br><span class="line">Decoded PAN: 432198765432109870</span><br></pre></td></tr></table></figure>
<h2 id="ANSI-X9-8"><a href="#ANSI-X9-8" class="headerlink" title="ANSI X9.8"></a>ANSI X9.8</h2><p>Same as ISO-0.</p>
<h3 id="OEM-1-DIEBOLD-DOCUTEL-NCR"><a href="#OEM-1-DIEBOLD-DOCUTEL-NCR" class="headerlink" title="OEM-1 / DIEBOLD / DOCUTEL / NCR"></a>OEM-1 / DIEBOLD / DOCUTEL / NCR</h3><p>The OEM-1 PIN block format is equivalent to the PIN block formats that Diebold, Docutel, and NCR define. The OEM-1 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-5"><a href="#CALCULATION-STEPS-5" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-P-is-PIN-digit-X-is-pad-value-which-is-a-4-bit-value-from"><a href="#1-Prepare-a-PIN-–-P-is-PIN-digit-X-is-pad-value-which-is-a-4-bit-value-from" class="headerlink" title="1.  Prepare a PIN – P is PIN digit, X is pad value, which is a 4-bit value from"></a>1.  Prepare a PIN – P is PIN digit, X is pad value, which is a 4-bit value from</h5><pre><code>X’0′ to X’F’</code></pre>
<table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>X – is a pad value has a 4-bit value from X’0′ to X’F’ and must be different<br>  from any PIN digit. The number of pad values for this format is in the range<br>  from 4 to 12, and all the pad values must have the same value.</p>
</li>
</ul>
<h4 id="EXAMPLE-5"><a href="#EXAMPLE-5" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line"> </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: Diebold, Docutel, NCR  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:1234555555555555</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 1234555555555555  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: Diebold, Docutel, NCR  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ECI-1"><a href="#ECI-1" class="headerlink" title="ECI-1"></a>ECI-1</h2><p>Same as ISO-0.</p>
<h2 id="ECI-2"><a href="#ECI-2" class="headerlink" title="ECI-2"></a>ECI-2</h2><p>The ECI-2 PIN block format supports a 4-digit PIN. A PIN that is longer than 4 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-6"><a href="#CALCULATION-STEPS-6" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-P-is-PIN-digit-R-is-random-value"><a href="#1-Prepare-a-PIN-–-P-is-PIN-digit-R-is-random-value" class="headerlink" title="1.  Prepare a PIN – P is PIN digit, R is random value"></a>1.  Prepare a PIN – P is PIN digit, R is random value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The PIN length<br>  for this format is always 4.The values of the PIN digits are independent.</p>
</li>
<li><p>R is a random pad value, which is a value from X’0′ to X’F’. This format<br>  contains 12 random pad values that can have different values.</p>
</li>
</ul>
<h4 id="EXAMPLE-6"><a href="#EXAMPLE-6" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: ECI-2  </span><br><span class="line"></span><br><span class="line">Clear PIN block:1234095621C2F02F</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 1234095621C2F02F  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: ECI-2  </span><br><span class="line"> </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ECI-3"><a href="#ECI-3" class="headerlink" title="ECI-3"></a>ECI-3</h2><p>The ECI-3 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-7"><a href="#CALCULATION-STEPS-7" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-–-is-PIN-length-P-is-PIN-digit-0-is-padding-character"><a href="#1-Prepare-a-PIN-–-L-–-is-PIN-length-P-is-PIN-digit-0-is-padding-character" class="headerlink" title="1.  Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character"></a>1.  Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character</h5><pre><code>for PIN shorter than 6 digits, R is random value</code></pre>
<table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/0</td>
<td>P/0</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  L is the length of the PIN, which is a 4-bit value from X’4′ to X’6′.</p>
</li>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>0 – is a filling character for PIN’s shorter than 6 digits, so 4 digit PIN<br>  will be extended to 6 digits (1234 -&gt; 123400).</p>
</li>
<li><p>R is a random pad value, which is a value from X’0′ to X’F’. This format<br>  contains 9 random pad values that can have different values.</p>
</li>
</ul>
<h4 id="EXAMPLE-7"><a href="#EXAMPLE-7" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: ECI-3  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:41234E07180DD697</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 41234E07180DD697  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: ECI-3  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="ECI-4"><a href="#ECI-4" class="headerlink" title="ECI-4"></a>ECI-4</h2><p>Same as ISO-1.</p>
<h2 id="IBM-3621"><a href="#IBM-3621" class="headerlink" title="IBM 3621"></a>IBM 3621</h2><p>The 3621 PIN block format supports a PIN from 1 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-8"><a href="#CALCULATION-STEPS-8" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-S1-S2-S3-S4-form-a-2-byte-sequence-number-that-3621-or-the-originating-terminal-or-node-assigns-P-is-PIN-digit-X-is-defined-padding-value"><a href="#1-Prepare-a-PIN-–-S1-S2-S3-S4-form-a-2-byte-sequence-number-that-3621-or-the-originating-terminal-or-node-assigns-P-is-PIN-digit-X-is-defined-padding-value" class="headerlink" title="1.  Prepare a PIN – S1,S2,S3,S4 form a 2-byte sequence number that 3621 (or the originating terminal or node) assigns. P is PIN digit, X is defined padding value"></a>1.  Prepare a PIN – S1,S2,S3,S4 form a 2-byte sequence number that 3621 (or the originating terminal or node) assigns. P is PIN digit, X is defined padding value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>S1</td>
<td>S2</td>
<td>S3</td>
<td>S4</td>
<td>P</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>S1 S2 S3 S4 – Forms a 2-byte sequence number that the 3621 (or the<br>  originating terminal or node) assigns. A 3621 assigns the sequence number in<br>  ascending order, starting with X’0000′.</p>
</li>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>X – is A pad value has a 4-bit value from X’0′ to X’F’ and must be different<br>  from any PIN digit. The number of pad values for this format are in the<br>  range from 0 to 11, and all the pad values must have the same value.</p>
</li>
</ul>
<h4 id="EXAMPLE-8"><a href="#EXAMPLE-8" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: IBM 3621  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:0000123455555555</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 0000123455555555  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: IBM 3621  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="IBM-3624"><a href="#IBM-3624" class="headerlink" title="IBM 3624"></a>IBM 3624</h2><p>The 3624 PIN block format supports a PIN from 1 to 16 digits in length. A PIN that is longer than 16 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-9"><a href="#CALCULATION-STEPS-9" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-P-is-PIN-digit-X-is-defined-padding-value"><a href="#1-Prepare-a-PIN-–-P-is-PIN-digit-X-is-defined-padding-value" class="headerlink" title="1.  Prepare a PIN – P is PIN digit, X is defined padding value"></a>1.  Prepare a PIN – P is PIN digit, X is defined padding value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>P</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
<td>P/X</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>X – is A pad value has a 4-bit value from X’0′ to X’F’ and must be different<br>  from any PIN digit. The number of pad values for this format are in the<br>  range from 0 to 15, and all the pad values must have the same value.</p>
</li>
</ul>
<h4 id="EXAMPLE-9"><a href="#EXAMPLE-9" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: IBM 3624  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:1234555555555555</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 1234555555555555  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: IBM 3624  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="IBM-4704-EPP-ENCRYPTING-PIN-PAD"><a href="#IBM-4704-EPP-ENCRYPTING-PIN-PAD" class="headerlink" title="IBM 4704-EPP (ENCRYPTING PIN PAD)"></a>IBM 4704-EPP (ENCRYPTING PIN PAD)</h2><p>The 4704 encrypting PIN Pad PIN block format supports a PIN from 1 to 13 digits in length. A PIN that is longer than 13 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-10"><a href="#CALCULATION-STEPS-10" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-–-is-a-PIN-length-P-is-PIN-digit-F-is-padding-value-‘F’-S1-S2-is-a-1-byte-sequence-number"><a href="#1-Prepare-a-PIN-–-L-–-is-a-PIN-length-P-is-PIN-digit-F-is-padding-value-‘F’-S1-S2-is-a-1-byte-sequence-number" class="headerlink" title="1.  Prepare a PIN – L – is a PIN length, P is PIN digit, F is padding value ‘F’, S1 S2 is a 1-byte sequence number"></a>1.  Prepare a PIN – L – is a PIN length, P is PIN digit, F is padding value ‘F’, S1 S2 is a 1-byte sequence number</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>L</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/X</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>S1</td>
<td>S2</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  L – is the length of the PIN, which is a 4-bit value from X’4′ to X’D’.</p>
</li>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>F – is A pad value has a 4-bit value of X’F’. The number of pad values for<br>  this format are in the range from 0 to 12.</p>
</li>
<li><p>  S1 S2 – is a 1-byte sequence number from X’00’ to X’FF’.</p>
</li>
</ul>
<h4 id="EXAMPLE-10"><a href="#EXAMPLE-10" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: IBM 4704 EPP  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:41234FFFFFFFFF00</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 41234FFFFFFFFF00  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: IBM 4704 EPP  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="IBM-5906"><a href="#IBM-5906" class="headerlink" title="IBM 5906"></a>IBM 5906</h2><p>Same as IBM 3621.</p>
<h2 id="VISA-1"><a href="#VISA-1" class="headerlink" title="VISA-1"></a>VISA-1</h2><p>Same as ISO-0.</p>
<h2 id="VISA-2"><a href="#VISA-2" class="headerlink" title="VISA-2"></a>VISA-2</h2><p>The VISA-2 PIN block format supports a PIN from 4 to 6 digits in length. A PIN that is longer than 6 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-11"><a href="#CALCULATION-STEPS-11" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-–-is-PIN-length-P-is-PIN-digit-0-is-padding-character-1"><a href="#1-Prepare-a-PIN-–-L-–-is-PIN-length-P-is-PIN-digit-0-is-padding-character-1" class="headerlink" title="1.  Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character"></a>1.  Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character</h5><pre><code>for PIN shorter than 6 digits, D is decimal value</code></pre>
<table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/0</td>
<td>P/0</td>
<td>D</td>
<td>D</td>
<td>D</td>
<td>D</td>
<td>D</td>
<td>D</td>
<td>D</td>
<td>D</td>
<td>D</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  L is the length of the PIN, which is a 4-bit value from X’4′ to X’6′.</p>
</li>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>0 – is a filling character for PIN’s shorter than 6 digits, so 4 digit PIN<br>  will be extended to 6 digits (1234 -&gt; 123400).</p>
</li>
<li><p>D is a decimal pad value, which is a 4-bit value from X’0′ to X’9′. All nine<br>  pad values must have the same value.</p>
</li>
</ul>
<h4 id="EXAMPLE-11"><a href="#EXAMPLE-11" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: VISA-2  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:4123400555555555</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 4123400555555555  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: VISA-2  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="VISA-3"><a href="#VISA-3" class="headerlink" title="VISA-3"></a>VISA-3</h2><p>The VISA-3 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-12"><a href="#CALCULATION-STEPS-12" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-P-is-PIN-digit-F-is-PIN-delimiter-X-is-a-pad-value"><a href="#1-Prepare-a-PIN-–-P-is-PIN-digit-F-is-PIN-delimiter-X-is-a-pad-value" class="headerlink" title="1.  Prepare a PIN – P is PIN digit, F is PIN delimiter, X is a pad value"></a>1.  Prepare a PIN – P is PIN digit, F is PIN delimiter, X is a pad value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F/X</td>
<td>P/F/X</td>
<td>P/F/X</td>
<td>P/F/X</td>
<td>P/F/X</td>
<td>P/F/X</td>
<td>P/F/X</td>
<td>F/X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>P – is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>F – is a a PIN digit or a delimiter X’F’. If the preceding digit is the last<br>  (or rightmost) PIN digit, this digit is the delimiter X’F’.</p>
</li>
<li><p>X is a pad value, which is a 4-bit value from X’0′ to X’F’. All the pad<br>  values must have the same value.</p>
</li>
</ul>
<h4 id="EXAMPLE-12"><a href="#EXAMPLE-12" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: 5  </span><br><span class="line">Format: VISA-3  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:1234F55555555555</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 1234F55555555555  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: VISA-3  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="VISA-4"><a href="#VISA-4" class="headerlink" title="VISA-4"></a>VISA-4</h2><p>The VISA-4 PIN block format supports a PIN from 4 to 12 digits in length. A PIN that is longer than 12 digits is truncated on the right.</p>
<h4 id="CALCULATION-STEPS-13"><a href="#CALCULATION-STEPS-13" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-0-–-is-the-value-X’0′-L-is-length-of-the-PIN-P-is-PIN-digit-F-–-is-the-value-X’F’-for-the-pad-value-PAN-is-twelve-4-bit-digits-representing-the-leftmost-12-digits-of-the-primary-account-number-excluding-the-check-digit"><a href="#1-Prepare-a-PIN-–-0-–-is-the-value-X’0′-L-is-length-of-the-PIN-P-is-PIN-digit-F-–-is-the-value-X’F’-for-the-pad-value-PAN-is-twelve-4-bit-digits-representing-the-leftmost-12-digits-of-the-primary-account-number-excluding-the-check-digit" class="headerlink" title="1.  Prepare a PIN – 0 – is the value X’0′, L is length of the PIN, P is PIN digit, F – is the value X’F’ for the pad value, PAN is twelve 4-bit digits representing the leftmost 12 digits of the primary account number (excluding the check digit)."></a>1.  Prepare a PIN – 0 – is the value X’0′, L is length of the PIN, P is PIN digit, F – is the value X’F’ for the pad value, PAN is twelve 4-bit digits representing the leftmost 12 digits of the primary account number (excluding the check digit).</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>F</td>
<td>F</td>
</tr>
</tbody></table>
<h5 id="2-Prepare-PAN-–-take-12-leftmost-digits-of-the-primary-account-number-excluding-the-check-digit"><a href="#2-Prepare-PAN-–-take-12-leftmost-digits-of-the-primary-account-number-excluding-the-check-digit" class="headerlink" title="2.  Prepare PAN – take 12 leftmost digits of the primary account number (excluding the check digit)"></a>2.  Prepare PAN – take 12 leftmost digits of the primary account number (excluding the check digit)</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
</tr>
</tbody></table>
<h5 id="3-XOR-both-values-1"><a href="#3-XOR-both-values-1" class="headerlink" title="3.  XOR both values"></a>3.  XOR both values</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>P/F</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
<td>XOR</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
<td>PAN</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  0 is the value X’0′</p>
</li>
<li><p>  L – is a PIN length</p>
</li>
<li><p>P is a PIN digit, which is a 4-bit value from X’0′ to X’9′. The values of<br>  the PIN digits are independent.</p>
</li>
<li><p>F – is a pad value of X’F’. The number of PAD digits X’F’ in the<br>  intermediate PIN block (IPB) is in the range from 2 to 10.</p>
</li>
<li><p>PAN – is twelve 4-bit digits representing the leftmost 12 digits of the<br>  primary account number (excluding the check digit). Each PAN digit has a<br>  value from X’0′ to X’9′.</p>
</li>
</ul>
<h4 id="EXAMPLE-13"><a href="#EXAMPLE-13" class="headerlink" title="EXAMPLE:"></a>EXAMPLE:</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block encrypt operation finished  </span><br><span class="line">  </span><br><span class="line">PAN: 43219876543210987  </span><br><span class="line">PIN: 1234  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: VISA-4  </span><br><span class="line">  </span><br><span class="line">Clear PIN block:041277DE6789ABCD</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">PIN blocks: PIN block decode operation finished  </span><br><span class="line">  </span><br><span class="line">PIN block: 041277DE6789ABCD  </span><br><span class="line">PAN: N&#x2F;A  </span><br><span class="line">PAD: N&#x2F;A  </span><br><span class="line">Format: VISA-4  </span><br><span class="line">  </span><br><span class="line">Decoded PIN: 1234</span><br></pre></td></tr></table></figure>
<h2 id="AS2805-FORMAT-1"><a href="#AS2805-FORMAT-1" class="headerlink" title="AS2805 FORMAT 1"></a>AS2805 FORMAT 1</h2><p>The AS2805 Format 1 PIN block format is similar to an ISO-1 PIN block format. The PIN block format supports a PIN from 4 to 12 digits in length.</p>
<h4 id="CALCULATION-STEPS-14"><a href="#CALCULATION-STEPS-14" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value-1"><a href="#1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value-1" class="headerlink" title="1.  Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value"></a>1.  Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>1</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>R</td>
<td>R</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>  L – is the length of the PIN, which is a 4-bit value from X’4′ to X’C’.</p>
</li>
<li><p>  R – is a random digit, which is a value from X’0′ to X’F’.</p>
</li>
</ul>
<h2 id="AS2805-FORMAT-8-FORMAT-46"><a href="#AS2805-FORMAT-8-FORMAT-46" class="headerlink" title="AS2805 FORMAT 8 (FORMAT 46)"></a>AS2805 FORMAT 8 (FORMAT 46)</h2><p>The AS2805 Format 8 PIN block (format 46) is similar to an Format 1 PIN block format. The PIN block format supports zero length PIN Block.</p>
<h4 id="CALCULATION-STEPS-15"><a href="#CALCULATION-STEPS-15" class="headerlink" title="CALCULATION STEPS:"></a>CALCULATION STEPS:</h4><h5 id="1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value-2"><a href="#1-Prepare-a-PIN-–-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value-2" class="headerlink" title="1.  Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value"></a>1.  Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value</h5><table>
<thead>
<tr>
<th><strong>1</strong></th>
<th><strong>2</strong></th>
<th><strong>3</strong></th>
<th><strong>4</strong></th>
<th><strong>5</strong></th>
<th><strong>6</strong></th>
<th><strong>7</strong></th>
<th><strong>8</strong></th>
<th><strong>9</strong></th>
<th><strong>10</strong></th>
<th><strong>11</strong></th>
<th><strong>12</strong></th>
<th><strong>13</strong></th>
<th><strong>14</strong></th>
<th><strong>15</strong></th>
<th><strong>16</strong></th>
</tr>
</thead>
<tbody><tr>
<td>C</td>
<td>L</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>P/R</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>0</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>R</td>
<td>F</td>
<td>F</td>
</tr>
</tbody></table>
<p>Where:</p>
<ul>
<li><p>C – Control field, if is X’0′, then the PIN block is processed as a standard<br>  format 01 PIN block.</p>
</li>
<li><p>L – is the length of the PIN, which is a 4-bit X’0′ or value from X’4′ to<br>  X’C’. If it is X’0′ then the PIN block is a Zero PIN block. No checking of<br>  the PIN block is required in this case.</p>
</li>
<li><p>  R – is a random digit, which is a value from X’0′ to X’F’.</p>
</li>
<li><p>  F – the X’F’ character.</p>
</li>
</ul>

      </div>
      
        <div class="prev-or-next">
          <div class="post-foot-next">
            
              <a href="/2020/12/23/Complete-list-of-MicroFocus-HPE-Atalla-HSM/" target="_self">
                <i class="iconfont icon-chevronleft"></i>
                <span>Prev</span>
              </a>
            
          </div>
          <div class="post-attach">
            <span class="post-pubtime">
              <i class="iconfont icon-updatetime" title="Update time"></i>
              2020-12-23
            </span>
            
                  <span class="post-tags">
                    <i class="iconfont icon-tags" title="Tags"></i>
                    
                    <span class="span--tag">
                      <a href="/tags/EMV/" title="EMV">
                        <b>#</b> EMV
                      </a>
                    </span>
                    
                  </span>
              
          </div>
          <div class="post-foot-prev">
            
              <a href="/2020/12/23/Complete-list-of-Registered-Application-Provider/" target="_self">
                <span>Next</span>
                <i class="iconfont icon-chevronright"></i>
              </a>
            
          </div>
        </div>
      
    </div>
    
  <div class="post-catalog" id="catalog">
    <div class="title">Contents</div>
    <div class="catalog-content">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#ISO-0-FORMAT-0"><span class="toc-text">ISO-0 (FORMAT 0)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-padding-value-%E2%80%9CF%E2%80%9D"><span class="toc-text">1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value “F”</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-Prepare-PAN-%E2%80%93-take-12-rightmost-digits-of-the-primary-account-number-excluding-the-check-digit"><span class="toc-text">2. Prepare PAN – take 12 rightmost digits of the primary account number (excluding the check digit)</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-XOR-both-values"><span class="toc-text">3. XOR both values</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ISO-1-FORMAT-1"><span class="toc-text">ISO-1 (FORMAT 1)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-1"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value"><span class="toc-text">1. Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-1"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ISO-2-FORMAT-2"><span class="toc-text">ISO-2 (FORMAT 2)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-2"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-padding-value-%E2%80%98F%E2%80%99"><span class="toc-text">1. Prepare a PIN – L is length of the PIN, P is PIN digit, F is padding value ‘F’</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-2"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ISO-3-FORMAT-3"><span class="toc-text">ISO-3 (FORMAT 3)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-3"><span class="toc-text">CALCULATION STEPS:</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-3"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ISO-4-FORMAT-4"><span class="toc-text">ISO-4 (FORMAT 4)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-4"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-is-length-of-the-PIN-P-is-PIN-digit-F-is-fill-digit-%E2%80%98A%E2%80%99-R-is-random-value-from-X%E2%80%990%E2%80%B2-to-X%E2%80%99F%E2%80%99"><span class="toc-text">1.  Prepare a PIN – L is length of the PIN, P is PIN digit, F is fill digit ‘A’. R is random value from X’0′ to X’F’</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-Prepare-PAN-%E2%80%93-take-the-primary-account-number-%E2%80%93-M-is-PAN-length-indicating-PAN-length-of-12-plus-the-value-of-the-field-%E2%80%980%E2%80%99-%E2%80%987%E2%80%99-ranging-then-from-12-to-19-If-the-PAN-is-less-than-12-digits-the-digits-are-right-justified-and-padded-to-the-left-with-zeros-and-M-is-set-to-%E2%80%980%E2%80%99-A-is-PAN-digit-0-is-PAD-digit-%E2%80%980%E2%80%99"><span class="toc-text">2.  Prepare PAN – take the primary account number – M is PAN length indicating PAN length of 12 plus the value of the field ‘0’-‘7’ (ranging then from 12 to 19). If the PAN is less than 12 digits, the digits are right justified and padded to the left with zeros and M is set to ‘0’. A is PAN digit, 0 is PAD digit ‘0’</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-PIN-block-is-encrypted-with-AES-key"><span class="toc-text">2.  PIN block is encrypted with AES key</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-The-resulting-Intermediate-Block-A-is-then-XOR%E2%80%99ed-with-PAN-Block"><span class="toc-text">3.  The resulting Intermediate Block A is then XOR’ed with PAN Block</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#4-The-resulting-Intermediate-Block-B-is-enciphered-with-the-AES-key-again-so-we-get-the-Enciphered-PIN-Block"><span class="toc-text">4.  The resulting Intermediate Block B is enciphered with the AES key again so we get the Enciphered PIN Block</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-4"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ANSI-X9-8"><span class="toc-text">ANSI X9.8</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#OEM-1-DIEBOLD-DOCUTEL-NCR"><span class="toc-text">OEM-1 &#x2F; DIEBOLD &#x2F; DOCUTEL &#x2F; NCR</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-5"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-P-is-PIN-digit-X-is-pad-value-which-is-a-4-bit-value-from"><span class="toc-text">1.  Prepare a PIN – P is PIN digit, X is pad value, which is a 4-bit value from</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-5"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ECI-1"><span class="toc-text">ECI-1</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ECI-2"><span class="toc-text">ECI-2</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-6"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-P-is-PIN-digit-R-is-random-value"><span class="toc-text">1.  Prepare a PIN – P is PIN digit, R is random value</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-6"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ECI-3"><span class="toc-text">ECI-3</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-7"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-%E2%80%93-is-PIN-length-P-is-PIN-digit-0-is-padding-character"><span class="toc-text">1.  Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-7"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ECI-4"><span class="toc-text">ECI-4</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IBM-3621"><span class="toc-text">IBM 3621</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-8"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-S1-S2-S3-S4-form-a-2-byte-sequence-number-that-3621-or-the-originating-terminal-or-node-assigns-P-is-PIN-digit-X-is-defined-padding-value"><span class="toc-text">1.  Prepare a PIN – S1,S2,S3,S4 form a 2-byte sequence number that 3621 (or the originating terminal or node) assigns. P is PIN digit, X is defined padding value</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-8"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IBM-3624"><span class="toc-text">IBM 3624</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-9"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-P-is-PIN-digit-X-is-defined-padding-value"><span class="toc-text">1.  Prepare a PIN – P is PIN digit, X is defined padding value</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-9"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IBM-4704-EPP-ENCRYPTING-PIN-PAD"><span class="toc-text">IBM 4704-EPP (ENCRYPTING PIN PAD)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-10"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-%E2%80%93-is-a-PIN-length-P-is-PIN-digit-F-is-padding-value-%E2%80%98F%E2%80%99-S1-S2-is-a-1-byte-sequence-number"><span class="toc-text">1.  Prepare a PIN – L – is a PIN length, P is PIN digit, F is padding value ‘F’, S1 S2 is a 1-byte sequence number</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-10"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IBM-5906"><span class="toc-text">IBM 5906</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#VISA-1"><span class="toc-text">VISA-1</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#VISA-2"><span class="toc-text">VISA-2</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-11"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-%E2%80%93-is-PIN-length-P-is-PIN-digit-0-is-padding-character-1"><span class="toc-text">1.  Prepare a PIN – L – is PIN length, P is PIN digit, 0 is padding character</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-11"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#VISA-3"><span class="toc-text">VISA-3</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-12"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-P-is-PIN-digit-F-is-PIN-delimiter-X-is-a-pad-value"><span class="toc-text">1.  Prepare a PIN – P is PIN digit, F is PIN delimiter, X is a pad value</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-12"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#VISA-4"><span class="toc-text">VISA-4</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-13"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-0-%E2%80%93-is-the-value-X%E2%80%990%E2%80%B2-L-is-length-of-the-PIN-P-is-PIN-digit-F-%E2%80%93-is-the-value-X%E2%80%99F%E2%80%99-for-the-pad-value-PAN-is-twelve-4-bit-digits-representing-the-leftmost-12-digits-of-the-primary-account-number-excluding-the-check-digit"><span class="toc-text">1.  Prepare a PIN – 0 – is the value X’0′, L is length of the PIN, P is PIN digit, F – is the value X’F’ for the pad value, PAN is twelve 4-bit digits representing the leftmost 12 digits of the primary account number (excluding the check digit).</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-Prepare-PAN-%E2%80%93-take-12-leftmost-digits-of-the-primary-account-number-excluding-the-check-digit"><span class="toc-text">2.  Prepare PAN – take 12 leftmost digits of the primary account number (excluding the check digit)</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-XOR-both-values-1"><span class="toc-text">3.  XOR both values</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#EXAMPLE-13"><span class="toc-text">EXAMPLE:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#AS2805-FORMAT-1"><span class="toc-text">AS2805 FORMAT 1</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-14"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value-1"><span class="toc-text">1.  Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value</span></a></li></ol></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#AS2805-FORMAT-8-FORMAT-46"><span class="toc-text">AS2805 FORMAT 8 (FORMAT 46)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#CALCULATION-STEPS-15"><span class="toc-text">CALCULATION STEPS:</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-Prepare-a-PIN-%E2%80%93-L-is-length-of-the-PIN-P-is-PIN-digit-R-is-random-value-2"><span class="toc-text">1.  Prepare a PIN – L is length of the PIN, P is PIN digit, R is random value</span></a></li></ol></li></ol></li></ol></li></ol>
    </div>
  </div>

  
<script src="/js/catalog.js"></script>




    
      <div class="comments-container">
        




  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
  <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>

  <div id="gitalk-container"></div>
  <script src="/js/md5.min.js"></script>
  <script>
    const gitalk = new Gitalk({
      clientID: '57cd3399b19f860fecc9',
      clientSecret: '2190b5d0de9a59b3de639f23ad0b771ead37dcca',
      repo: 'longxiying.github.io',
      owner: 'longxiying',
      admin: ['longxiying'],
      id: md5(location.pathname),
      distractionFreeMode: false
    })

    gitalk.render('gitalk-container')
  </script>


      </div>
    
  </div>


        <div class="footer">
  <div class="social">
    <ul>
      
        <li>
          <a title="github" target="_blank" rel="noopener" href="https://github.com/longxiying">
            <i class="iconfont icon-github"></i>
          </a>
        </li>
      
        <li>
          <a title="email" href="mailto:longxiying@vip.qq.com">
            <i class="iconfont icon-envelope"></i>
          </a>
        </li>
      
        <li>
          <a title="facebook" target="_blank" rel="noopener" href="https://www.facebook.com/abtswiath/">
            <i class="iconfont icon-facebooksquare"></i>
          </a>
        </li>
      
        <li>
          <a title="twitter" target="_blank" rel="noopener" href="https://twitter.com/longxiying">
            <i class="iconfont icon-twitter"></i>
          </a>
        </li>
      
        <li>
          <a title="wechat" href="">
            <i class="iconfont icon-wechat"></i>
          </a>
        </li>
      
        <li>
          <a title="weibo" target="_blank" rel="noopener" href="https://weibo.com/579081111/">
            <i class="iconfont icon-weibo"></i>
          </a>
        </li>
      
        <li>
          <a title="rss" href="/atom.xml">
            <i class="iconfont icon-rss"></i>
          </a>
        </li>
      
    </ul>
  </div>
  
    <div class="footer-more">
      
        <a href="https://emv.cool">Copyright © EMV.COOL 2020</a>
        
    </div>
  
    <div class="footer-more">
      
        <a target="_blank" rel="noopener" href="https://github.com/zchengsite/hexo-theme-oranges">Theme by Oranges | Powered by Hexo</a>
        
    </div>
  
</div>

      </div>

      <div class="back-to-top hidden">
  <a href="javascript: void(0)">
    <i class="iconfont icon-chevronup"></i>
  </a>
</div>


<script src="/js/backtotop.js"></script>



      
  <div class="search-icon" id="search-icon">
    <a href="javascript: void(0)">
      <i class="iconfont icon-search"></i>
    </a>
  </div>

  <div class="search-overlay hidden">
    <div class="search-content" tabindex="0">
      <div class="search-title">
        <span class="search-icon-input">
          <a href="javascript: void(0)">
            <i class="iconfont icon-search"></i>
          </a>
        </span>
        
          <input type="text" class="search-input" id="search-input" placeholder="Search...">
        
        <span class="search-close-icon" id="search-close-icon">
          <a href="javascript: void(0)">
            <i class="iconfont icon-close"></i>
          </a>
        </span>
      </div>
      <div class="search-result" id="search-result"></div>
    </div>
  </div>

  <script type="text/javascript">
    var inputArea = document.querySelector("#search-input")
    var searchOverlayArea = document.querySelector(".search-overlay")

    inputArea.onclick = function() {
      getSearchFile()
      this.onclick = null
    }

    inputArea.onkeydown = function() {
      if(event.keyCode == 13)
        return false
    }

    function openOrHideSearchContent() {
      let isHidden = searchOverlayArea.classList.contains('hidden')
      if (isHidden) {
        searchOverlayArea.classList.remove('hidden')
        document.body.classList.add('hidden')
        // inputArea.focus()
      } else {
        searchOverlayArea.classList.add('hidden')
        document.body.classList.remove('hidden')
      }
    }

    function blurSearchContent(e) {
      if (e.target === searchOverlayArea) {
        openOrHideSearchContent()
      }
    }

    document.querySelector("#search-icon").addEventListener("click", openOrHideSearchContent, false)
    document.querySelector("#search-close-icon").addEventListener("click", openOrHideSearchContent, false)
    searchOverlayArea.addEventListener("click", blurSearchContent, false)

    var searchFunc = function (path, search_id, content_id) {
      'use strict';
      var $input = document.getElementById(search_id);
      var $resultContent = document.getElementById(content_id);
      $resultContent.innerHTML = "<ul><span class='local-search-empty'>First search, index file loading, please wait...<span></ul>";
      $.ajax({
        // 0x01. load xml file
        url: path,
        dataType: "xml",
        success: function (xmlResponse) {
          // 0x02. parse xml file
          var datas = $("entry", xmlResponse).map(function () {
            return {
              title: $("title", this).text(),
              content: $("content", this).text(),
              url: $("url", this).text()
            };
          }).get();
          $resultContent.innerHTML = "";

          $input.addEventListener('input', function () {
            // 0x03. parse query to keywords list
            var str = '<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length <= 0) {
              return;
            }
            // 0x04. perform local searching
            datas.forEach(function (data) {
              var isMatch = true;
              var content_index = [];
              if (!data.title || data.title.trim() === '') {
                data.title = "Untitled";
              }
              var orig_data_title = data.title.trim();
              var data_title = orig_data_title.toLowerCase();
              var orig_data_content = data.content.trim().replace(/<[^>]+>/g, "");
              var data_content = orig_data_content.toLowerCase();
              var data_url = data.url;
              var index_title = -1;
              var index_content = -1;
              var first_occur = -1;
              // only match artiles with not empty contents
              if (data_content !== '') {
                keywords.forEach(function (keyword, i) {
                  index_title = data_title.indexOf(keyword);
                  index_content = data_content.indexOf(keyword);

                  if (index_title < 0 && index_content < 0) {
                    isMatch = false;
                  } else {
                    if (index_content < 0) {
                      index_content = 0;
                    }
                    if (i == 0) {
                      first_occur = index_content;
                    }
                    // content_index.push({index_content:index_content, keyword_len:keyword_len});
                  }
                });
              } else {
                isMatch = false;
              }
              // 0x05. show search results
              if (isMatch) {
                str += "<li><a href='" + data_url + "' class='search-result-title'>" + orig_data_title + "</a>";
                var content = orig_data_content;
                if (first_occur >= 0) {
                  // cut out 100 characters
                  var start = first_occur - 20;
                  var end = first_occur + 80;

                  if (start < 0) {
                    start = 0;
                  }

                  if (start == 0) {
                    end = 100;
                  }

                  if (end > content.length) {
                    end = content.length;
                  }

                  var match_content = content.substr(start, end);

                  // highlight all keywords
                  keywords.forEach(function (keyword) {
                    var regS = new RegExp(keyword, "gi");
                    match_content = match_content.replace(regS, "<span class=\"search-keyword\">" + keyword + "</span>");
                  });

                  str += "<p class=\"search-result-abstract\">" + match_content + "...</p>"
                }
                str += "</li>";
              }
            });
            str += "</ul>";
            if (str.indexOf('<li>') === -1) {
              return $resultContent.innerHTML = "<ul><span class='local-search-empty'>No result<span></ul>";
            }
            $resultContent.innerHTML = str;
          });
        },
        error: function(xhr, status, error) {
          $resultContent.innerHTML = ""
          if (xhr.status === 404) {
            $resultContent.innerHTML = "<ul><span class='local-search-empty'>The search.xml file was not found, please refer to：<a href='https://github.com/zchengsite/hexo-theme-oranges#configuration' target='_black'>configuration</a><span></ul>";
          } else {
            $resultContent.innerHTML = "<ul><span class='local-search-empty'>The request failed, Try to refresh the page or try again later.<span></ul>";
          }
        }
      });
      $(document).on('click', '#search-close-icon', function() {
        $('#search-input').val('');
        $('#search-result').html('');
      });
    }

    var getSearchFile = function() {
        var path = "/search.xml";
        searchFunc(path, 'search-input', 'search-result');
    }
  </script>




    </div>
  </body>
</html>
